package networkinstance;

public class Main5 {
    public static void main(String[] args) {
        try {
            java.net.URL url = new java.net.URL("http://www.runoob.com");
            java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(url.openStream()));
            java.io.BufferedWriter writer = new java.io.BufferedWriter(new java.io.FileWriter("data.html"));
            String line = null;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
                writer.write(line);
                writer.newLine();
            }
            reader.close();
            writer.close();
        } catch (java.io.IOException e) {
            throw new RuntimeException(e);
        }
    }
}
